package handler

import (
	"jx3_bot/common"

	"github.com/tidwall/gjson"
)

func DailyTasksHandle(uid, groupID, server string) {
	if server == "" {
		server = "梦江南" // 绑定默认服务器
	}
	url := "https://www.jx3api.com/data/active/current?num=0&server=" + server
	body, err := common.HttpGet(url)
	if err != nil {
		return
	}

	date := gjson.Get(body, "data.date").String()
	week := gjson.Get(body, "data.week").String()
	war := gjson.Get(body, "data.war").String()
	battle := gjson.Get(body, "data.battle").String()

	resp := "[Text]时间: " + date + "  星期" + week +
		"[Line]大战: " + war +
		"[Line]战场: " + battle

	common.SendGroupMessage(groupID, resp, false)
}
